<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        document.onkeydown = function ( event ){
            var e = event || window.event ;  
            var key = e.key ;
            // console.log(e);
            switch( key ){
                case 'a' :
                    console.log( e.altKey ) ;
                    if ( e.altKey ){
                        console.log("按下了alt+a");
                    }
                    break ; 
                case 'b' :
                    if ( e.ctrlKey ){
                        console.log("按下了ctr+b");
                    }
                    break;
                case 'C' :
                    if ( e.shiftKey ){
                        console.log("按下了shift+c");
                    }
                    break;
                default:
                    break;
            }
        }
    </script>
</body>
</html>